/**
 * 
 */
package com.easidea.tim.test.service.system;

import junit.framework.Assert;

import org.junit.Test;

import com.easidea.tim.entity.system.Geography;
import com.easidea.tim.service.system.GeographyService;
import com.easidea.tim.test.SpringIntegrationTestCase;


/**
 * @author Harrison
 *
 */
public class GeographyServiceTestCase extends SpringIntegrationTestCase{
	private GeographyService geographyService;
	
	@Test
	public void testSaveFirstLevelGeo(){
		Assert.assertNotNull(geographyService);
		Geography geo = new Geography();
		geo.setName("test");
		geographyService.save(geo);
	}

	@Test
	public void testSaveSonLevelGeo(){
		Assert.assertNotNull(geographyService);
		Geography parent = new Geography();
		parent.setId(2L);
		Geography son = new Geography();
		son.setName("son test");
		son.setParentGeo(parent);
		geographyService.saveGeo(son);
	}
	
	@Test
	public void testParentSonListRetrive(){
		Assert.assertNotNull(geographyService);
		Assert.assertTrue(((Geography)geographyService.get(2L)).getSonList().size() > 0);
	}
	
	public GeographyService getGeographyService() {
		return geographyService;
	}


	public void setGeographyService(GeographyService geographyService) {
		this.geographyService = geographyService;
	}
}
